function kembali(typenya){
	_post = [{name:'type', value: typenya}];		
	$('#setup_'+typenya).html('');
	$('#setup_'+typenya).addClass("loading");
	$.post(host+'setup/gettab/', _post, function(resp) {
		$('#setup_'+typenya).removeClass('loading')
		$('#setup_'+typenya).html(resp);							
	});	
}

$("body").off("#usrm_toright");
$("body").on("click","#usrm_toright",function(e){
    e.preventDefault();
    if($('#usrm_role1 :selected').length > 0){
        $('#usrm_role').append($('#usrm_role1 :selected')); 
    }
});
		
$("body").off("#usrm_toleft");
$("body").on("click","#usrm_toleft",function(e){
    e.preventDefault();
    if($('#usrm_role :selected').length > 0){
        $('#usrm_role1').append($('#usrm_role :selected'));
    }
});

$("#btnSend_policy").die();
$("#btnSend_policy").live("click",function(e){
    e.preventDefault();
    var dom={};
    var role_id = $(this).attr("data");
    $('.ck:checkbox:checked').each(function(i) { 
        dom[i]=$(this).attr("data");
    });
    $.post(host+"setup/savePolicy",{dom_checked:dom,role_id:role_id},function(resp){
       kembali("user_role");
       $.messager.alert("Info","Data Saved","info");
    });
})
